package com.example.service.student;

import com.example.entity.DTO.CourseDetailDTO;
import com.example.entity.DTO.StudentCourseDetailDTO;
import com.example.entity.StudentCourse;
import com.example.mapper.CourseMapper;
import com.example.mapper.StudentCourseMapper;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StudentCourseService {
    @Resource
    private StudentCourseMapper studentCourseMapper;

    public List<StudentCourseDetailDTO> selectAllCourse(String courseName, String teacherName, Integer studentId) {
        return studentCourseMapper.selectAllCourseByNameAndTeacherName(courseName, teacherName, studentId);
    }

    public void addStudentCourse(StudentCourse studentCourse) {
        studentCourseMapper.insert(studentCourse);
    }

    public List<StudentCourseDetailDTO> selectAllStudentCourse(Integer studentId) {
        return studentCourseMapper.selectAllByStudentId(studentId);
    }

    public void deleteStudentCourse(Integer id) {
        studentCourseMapper.deleteById(id);
    }
}
